// TODO: 需要处理 Vue3 Vue2 兼容问题
// import VueAxios from "vue-axios";

import httpClient from "./src/http-client";
import interceptors from "./src/interceptors";

// 添加拦截器
interceptors.forEach((interceptor) => {
  interceptor.use(httpClient);
});

/**
 * 插件安装方法
 * in Vue2 target = Vue
 * in Vue3 target = createApp(MyApp)
 * 本质是 VueAxios 处理了 Vue 版本的差异。
 * @param {*} target 插件安装目标
 * @param {*} options
 */
httpClient.install = function (target, options = {}) {
  target.use(VueAxios, httpClient);
};

export default httpClient;
